package ylsb.support;

public class BooleanMessage {

	  public static int STATE_ERROR = 0;
	  public static int STATE_SUCCESS = 1;
	  public static int STATE_WARN = 2;



	  
	  private int state;



	  
	  public int getState() { return this.state; }

	  
	  public void setState(int state) { this.state = state; }

	  
	  private boolean ok = false;
	  
	  private Object message;
	  
	  public boolean isOk() { return this.ok; }

	  
	  public void setOk(boolean ok) { this.ok = ok; }

	  
	  public Object getMessage() { return this.message; }

	  
	  public void setMessage(Object message) { this.message = message; }

	  
	  public static BooleanMessage getSuccessMessage(Object message) {
	    BooleanMessage booleanMessage = new BooleanMessage();
	    booleanMessage.setOk(true);
	    booleanMessage.setState(STATE_SUCCESS);
	    booleanMessage.setMessage(message);
	    return booleanMessage;
	  }
	  
	  public static BooleanMessage getErrorMessage(String message) {
	    BooleanMessage booleanMessage = new BooleanMessage();
	    booleanMessage.setOk(false);
	    booleanMessage.setState(STATE_ERROR);
	    booleanMessage.setMessage(message);
	    return booleanMessage;
	  }
	  
	  public static BooleanMessage getWarnMessage(String message) {
	    BooleanMessage booleanMessage = new BooleanMessage();
	    booleanMessage.setOk(false);
	    booleanMessage.setState(STATE_WARN);
	    booleanMessage.setMessage(message);
	    return booleanMessage;
	  }
	
}
